/*
Copyright (c) [2012-2020] Microchip Technology Inc.  
    All rights reserved.
    You are permitted to use the accompanying software and its derivatives 
    with Microchip products. See the Microchip license agreement accompanying 
    this software, if any, for additional info regarding your rights and 
    obligations.
    
    MICROCHIP SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT 
    WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT 
    LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT 
    AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP OR ITS
    LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT 
    LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE 
    THEORY FOR ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT 
    LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES, 
    OR OTHER SIMILAR COSTS. 
*/

/**
 * This file shows example for X2CScope_Init implementation.
 */
#include <xc.h>
#include "X2CScopeComm.h"
#include "X2CScope.h"

void X2CScope_Init(void)
{
//    /************************************************/
//    /*    Configure IO for UART and X2Cscope        */
//    __builtin_write_RPCON(0x0000);
//    RPOR18bits.RP68R = 0x0001; //RD4/RP35->UART1:U1TX
//    RPINR18bits.U1RXR = 67;     //RD3/RP67->UART1:U1TX    
//    __builtin_write_RPCON(0x0800);
//    
//    U1BRG = 27; //115200 baud @50MHXZ UART clock
//    
//    U1MODEbits.UARTEN = 1;  //Enable UART peripheral
//    U1MODEbits.UTXEN = 1;   //Enable UART TX
//    U1MODEbits.URXEN = 1;   //Enable UART RX
    
    /******************************************************/
    /* Init X2Cscope and connect communication interfaces */
    X2CScope_HookUARTFunctions(sendSerial, receiveSerial, isReceiveDataAvailable, isSendReady);
    X2CScope_Initialise();
}
